<script language="JavaScript" type="text/javascript" src="{$GLOBALS.site_url}/system/ext/jquery/jquery-ui.js"></script>
<script language="JavaScript" type="text/javascript" src="{$GLOBALS.site_url}/system/ext/jquery/jquery.bgiframe.js"></script>
<script language="JavaScript" type="text/javascript" src="{$GLOBALS.site_url}/system/ext/jquery/jquery.highlight.js"></script>

{if $GLOBALS.user_page_uri == '/company'}
	{assign var='refineSearch' value=false}
{/if}

<script type="text/javascript" language="JavaScript">
{literal}
$.ui.dialog.prototype.options.bgiframe = true;
function submitForm(id) {
	lpp = document.getElementById("listings_per_page" + id);
	location.href = '?{/literal}searchId={$searchId}{literal}&action=search&page=1&listings_per_page=' + lpp.value + '&view={/literal}{$view}{literal}';
}
function SaveAd(noteId, url){
	$.get(url, function(data){
		$("#"+noteId).html(data);
	});
}
{/literal}
</script>

{if $ERRORS}
	{include file="error.tpl"}
{else}
    {if !empty($errors)}
        {foreach from=$errors key='error' item='error_msg'}
            {if $error == 'SIMPLY_HIRED_XML_READ_FAILED'}
                <p class="error">[[Failed to read XML from url]] - {$error_msg}</p>
            {/if}
        {/foreach}
    {/if}
	<div {if $refineSearch || $view == 'map'}class="results"{else}class="noRefine"{/if}>

		<div id="topResults">
			<div class="headerBgBlock">

				{if $is_company_profile_page}
					{assign var=tmp_listing value=$listings|@current}
					{if $userInfo.CompanyName ne '' }
						{assign var="companyName" value=$userInfo.CompanyName}
						<!-- This page of company profile, with list of vacancy -->
						{include file="company_profile.tpl"}
						{if isset($smarty.get.company_name)}{assign var=$companyName value=$smarty.get.company_name.equal}{/if}
						<div class="Results" id="compProfileInfo">[[Jobs by $companyName]]</div><span></span>
					{/if}
				{else}
					<div class="Results">[[Jobs Search Results]]</div><span></span>
				{/if}

				<!-- TOP QUICK LINKS -->
				{if $userInfo.CompanyName eq '' }
					<div class="topResultsLinks">
						<ul>
							<li class="modifySearchIco"><a href="{$GLOBALS.site_url}/find-jobs/?searchId={$searchId}"> [[Modify search]]</a></li>
							{if $listing_type_id != ''}
								{if $acl->isAllowed('save_searches')}
									<li class="saveSearchIco"><a onclick="popUpWindow('{$GLOBALS.site_url}/save-search/?searchId={$searchId}', 350, 300, '[[Save this Search]]', true, {if $GLOBALS.current_user.logged_in}true{else}false{/if}); return false;" href="{$GLOBALS.site_url}/save-search/?searchId={$searchId}">[[Save this Search]]</a></li>
								{elseif $acl->getPermissionParams('save_searches') == "message"}
									<li class="saveSearchIco"><a onclick="popUpWindow('{$GLOBALS.site_url}/access-denied/?permission=save_searches', 350, 300, '[[Save this Search]]'); return false;" href="{$GLOBALS.site_url}/save-search/?searchId={$searchId}">[[Save this Search]]</a></li>
								{/if}
								{if $acl->isAllowed('use_job_alerts')}
									<li class="saveSearchIco"><a onclick="popUpWindow('{$GLOBALS.site_url}/save-search/?searchId={$searchId}&alert=1', 350, 300, '[[Save Job Alert]]', true, {if $GLOBALS.current_user.logged_in}true{else}false{/if}); return false;" href="{$GLOBALS.site_url}/save-search/?searchId={$searchId}">[[Save Job Alert]]</a></li>
								{elseif $acl->getPermissionParams('use_job_alerts') == "message"}
									<li class="saveSearchIco"><a onclick="popUpWindow('{$GLOBALS.site_url}/access-denied/?permission=use_job_alerts', 350, 300, '[[Save Job Alert]]'); return false;" href="{$GLOBALS.site_url}/save-search/?searchId={$searchId}">[[Save Job Alert]]</a></li>
								{/if}
							{/if}
							<li class="savedIco">
								{if $GLOBALS.current_user.logged_in}
									{if $acl->isAllowed('save_job')}
										<a href="{$GLOBALS.site_url}/saved-jobs">[[Saved jobs]]</a>
									{elseif $acl->getPermissionParams('save_job') == "message"}
										<a href="{$GLOBALS.site_url}/saved-jobs"  onclick="popUpWindow('{$GLOBALS.site_url}/access-denied/?permission=save_job', 350, 300, '[[Saved jobs]]'); return false;">[[Saved jobs]]</a>
									{/if}
								{else}<a onclick="popUpWindow('{$GLOBALS.site_url}/saved-listings/?listing_type_id=job', 350, 300, '[[Saved jobs]]'); return false;" href="{$GLOBALS.site_url}/saved-listings/">[[Saved jobs]]</a>
								{/if}
							</li>
							<li class="savedIco">
								{if $GLOBALS.current_user.logged_in}
									{if $acl->isAllowed('save_searches')}
										<a href="{$GLOBALS.site_url}/saved-searches/">[[Saved searches]]</a>
									{elseif $acl->getPermissionParams('save_searches') == "message"}
										<a href="{$GLOBALS.site_url}/saved-searches/" onclick="popUpWindow('{$GLOBALS.site_url}/access-denied/?permission=save_searches', 350, 300, '[[Saved searches]]'); return false;">[[Saved searches]]</a>
									{/if}
								{else}<a onclick="popUpWindow('{$GLOBALS.site_url}/saved-searches/', 350, 300, '[[Saved searches]]'); return false;" href="{$GLOBALS.site_url}/saved-searches/">[[Saved searches]]</a>
								{/if}
							</li>
						</ul>
					</div>
				{/if}
				<!-- END TOP QUICK LINKS -->
			</div>

            {if $view_on_map}
                <div id="googleMap-links">
                    <a href="{$GLOBALS.site_url}{if $url == '/search-results-jobs/'}{$url}?searchId={$searchId}&amp;action=search&amp;{else}{$url}?{/if}page=1&amp;view=list" id="listView-icon" {if $view == 'list'}onclick="return false;" class="listLink-active"{/if}>[[List View]]</a> &nbsp;
                    <a href="{$GLOBALS.site_url}{if $url == '/search-results-jobs/'}{$url}?searchId={$searchId}&amp;action=search&amp;{else}{$url}?{/if}page=1&amp;view=map" id="mapView-icon" {if $view == 'map'}onclick="return false;" class="listLink-active"{/if}>[[Map View]]</a>
                </div>
                <div class="clr"></div>
            {/if}

			<!-- TOP RESULTS - PER PAGE - PAGE NAVIGATION -->
			<div class="topNavBarLeft"></div>
			<div class="topNavBar">
				<div class="numberResults">
					{assign var="listings_number" value=$listing_search.listings_number}
					[[Results:]] {$listings_number} {if $listings_number == 1}[[Job]]{else}[[Jobs]]{/if}
					{if $search_criteria.ZipCode.value.location and $search_criteria.ZipCode.value.radius}
						{assign var="radius" value=$search_criteria.ZipCode.value.radius}
						{capture name=radius_search_unit}
							[[$GLOBALS.radius_search_unit]]
						{/capture}
						{assign var="radius_search_unit" value=$smarty.capture.radius_search_unit|escape:"html"}
						{assign var="location" value=$search_criteria.ZipCode.value.location|escape:"html"}
						[[within $radius $radius_search_unit of $location]]
					{/if}
				</div>
				<div class="numberPerPage">
					<form id="listings_per_page_form" method="get" action="" class="tableSRNavPerPage">
					[[Number of jobs per page]]:
						<select id="listings_per_page1" name="listings_per_page1" onchange="submitForm(1); return false;">
						<option value="10" {if $listing_search.listings_per_page == 10}selected="selected"{/if}>10</option>
						<option value="20" {if $listing_search.listings_per_page == 20}selected="selected"{/if}>20</option>
						<option value="50" {if $listing_search.listings_per_page == 50}selected="selected"{/if}>50</option>
						<option value="100" {if $listing_search.listings_per_page == 100}selected="selected"{/if}>100</option>
					</select>
					</form>
				</div>
				<div class="pageNavigation">
					<span class="prevBtn"><img src="{image}prev_btn.png" alt="[[Previous]]"/>
					{if $listing_search.current_page-1 > 0}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page-1}&amp;view={$view}">[[Previous]]</a>{else}<a>[[Previous]]</a>{/if}</span>
					<span class="navigationItems">
						{if $listing_search.current_page-3 > 0}<a href="?searchId={$searchId}&amp;action=search&amp;page=1&amp;view={$view}">1</a>{/if}
						{if $listing_search.current_page-3 > 1}...{/if}
						{if $listing_search.current_page-2 > 0}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page-2}&amp;view={$view}">{$listing_search.current_page-2}</a>{/if}
						{if $listing_search.current_page-1 > 0}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page-1}&amp;view={$view}">{$listing_search.current_page-1}</a>{/if}
						<strong>{$listing_search.current_page}</strong>
						{if $listing_search.current_page+1 <= $listing_search.pages_number}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page+1}&amp;view={$view}">{$listing_search.current_page+1}</a>{/if}
						{if $listing_search.current_page+2 <= $listing_search.pages_number}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page+2}&amp;view={$view}">{$listing_search.current_page+2}</a>{/if}
						{if $listing_search.current_page+3 < $listing_search.pages_number}...{/if}
						{if $listing_search.current_page+3 < $listing_search.pages_number + 1}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.pages_number}&amp;view={$view}">{$listing_search.pages_number}</a>{/if}
					</span>
					<span class="nextBtn">{if $listing_search.current_page+1 <= $listing_search.pages_number}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page+1}&amp;view={$view}">[[Next]]</a>{else}<a>[[Next]]</a>{/if}
					<img src="{image}next_btn.png" alt="[[Next]]"/></span>
				</div>
			</div>
			<div class="topNavBarRight"></div>
			<!-- END TOP RESULTS - PER PAGE - PAGE NAVIGATION -->
		</div>

		<!-- START REFINE SEARCH -->
		{if $refineSearch || $view == 'map'}
            <div id="refineResults">
                <div id="blockBg">
                    <div id="blockTop"></div>
                    <div id="blockInner">
                        {if $view == 'map' && $listings}
                            <table cellpadding="0" cellspacing="0" width="100%" id="refineResults">
                                <thead>
                                    <tr>
                                        <th class="tableLeft"> </th>
                                        <th>&nbsp;[[Jobs Search Results]]:</th>
                                        <th class="tableRight"> </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td colspan="3">
                                            <div id="googleMap-searchResults">
                                                {foreach from=$listings item=listing name=listings}
                                                    {if empty($index)}{assign var=index value=0}{/if}
                                                    <div class="mapListings-results {cycle values = 'evenrow,oddrow' advance=true}">
                                                        <div {if $listing.latitude && $listing.longitude}class="listingsWithLocation" onmouseover="javascript: google.maps.event.trigger(markersArray[{$index}], 'click');" onmouseout="javascript: infoWindows[{$index}].close();"{else}class="listingsWithoutLocation" title="No Location"{/if}>
                                                            <a href="{$GLOBALS.site_url}/display-job/{$listing.id}/{$listing.Title|regex_replace:"/[\\/\\\:*?\"<>|%#$\s]/":"-"}.html?searchId={$searchId}&amp;page={$listing_search.current_page}" target="_blank"><strong>{$listing.Title}</strong></a><br />
                                                            <strong>Company:</strong>
                                                            {if $listing.company_name} {* JobG8 listing *}
                                                                <a href="{$GLOBALS.site_url}/company/{$listing.user.id}/{$listing.company_name|replace:" ":"-"|escape:"url"}">{$listing.company_name}</a>
                                                                    {else}
                                                                    <a href="{$GLOBALS.site_url}/company/{$listing.user.id}/{$listing.user.CompanyName|replace:" ":"-"|escape:"url"}">{$listing.user.CompanyName}</a>
                                                                {/if}
                                                            {if $listing.State},&nbsp;{$listing.State}{/if}
                                                        </div>
                                                    </div>
                                                    {if $listing.latitude && $listing.longitude}{assign var=index value=$index+1}{/if}
                                                {/foreach}
                                            </div>
                                            <div class="clr"></div>
                                            <div id="googleMap-pagging">
                                                <span class="prevBtn">
                                                    <img src="{image}prev_btn.png" alt=""/>
                                                    {if $listing_search.current_page-1 > 0}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page-1}&amp;view={$view}">[[Previous]]</a>{else}<a>[[Previous]]</a>{/if}
                                                </span>
                                                <span class="navigationItems">
                                                    {if $listing_search.current_page-3 > 0}<a href="?searchId={$searchId}&amp;action=search&amp;page=1&amp;view={$view}">1</a>{/if}
                                                    {if $listing_search.current_page-3 > 1}...{/if}
                                                    {if $listing_search.current_page-2 > 0}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page-2}&amp;view={$view}">{$listing_search.current_page-2}</a>{/if}
                                                    {if $listing_search.current_page-1 > 0}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page-1}&amp;view={$view}">{$listing_search.current_page-1}</a>{/if}
                                                    <strong>{$listing_search.current_page}</strong>
                                                    {if $listing_search.current_page+1 <= $listing_search.pages_number}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page+1}&amp;view={$view}">{$listing_search.current_page+1}</a>{/if}
                                                    {if $listing_search.current_page+2 <= $listing_search.pages_number}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page+2}&amp;view={$view}">{$listing_search.current_page+2}</a>{/if}
                                                    {if $listing_search.current_page+3 < $listing_search.pages_number}...{/if}
                                                    {if $listing_search.current_page+3 < $listing_search.pages_number + 1}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.pages_number}&amp;view={$view}">{$listing_search.pages_number}</a>{/if}
                                                </span>
                                                <span class="nextBtn">
                                                    {if $listing_search.current_page+1 <= $listing_search.pages_number}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page+1}&amp;view={$view}">[[Next]]</a>{else}<a>[[Next]]</a>{/if}
                                                    <img src="{image}next_btn.png" alt=""/>
                                                </span>
                                            </div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <div class="clr"><br/></div>
                        {/if}
                        {if $refineSearch}
                            <table cellpadding="0" cellspacing="0" id="currentSearch">
                                <thead>
                                    <tr>
                                        <th class="tableLeft"> </th>
                                        <th>&nbsp;[[Current Search]]:</th>
                                        <th class="tableRight"> </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td colspan="3">
                                            {foreach from=$currentSearch item=fieldInfo key=fieldID}
                                            {capture name="refineTranslationDomain"}Property_{$fieldID}{/capture}
                                                <div class="currentSearch"><strong>[[FormFieldCaptions!{$fieldInfo.name}]]</strong></div>
                                                {foreach from=$fieldInfo.field item=field_value key=field_type}
                                                    {if $field_type == 'monetary'}
                                                        {foreach from=$field_value item=val key=real_val name=loopVal}
                                                            {if $smarty.foreach.loopVal.iteration%2 == 0}
                                                                [[to]]
                                                            {/if}
                                                            <span class="curSearchItem"><a href="?searchId={$searchId}&amp;action=undo&amp;param={$fieldID}&amp;type={$field_type}&amp;value={$real_val|escape:'url'}{if $show_brief_or_detailed}&amp;show_brief_or_detailed={$show_brief_or_detailed}{/if}&amp;view={$view}">[[(undo)]]</a> {tr domain=$smarty.capture.refineTranslationDomain}{$val|escape:"html"}{/tr}</span>
                                                        {/foreach}
                                                    {elseif $field_type == 'multilist'}
                                                        {foreach from=$field_value item=val key=real_val}
                                                            <span class="curSearchItem"><a href="?searchId={$searchId}&amp;action=undo&amp;param={$fieldID}&amp;type={$field_type}&amp;value={$real_val|escape:'url'}{if $show_brief_or_detailed}&amp;show_brief_or_detailed={$show_brief_or_detailed}{/if}&amp;view={$view}">[[(undo)]]</a> {tr domain=$smarty.capture.refineTranslationDomain}{$val|escape:"html"}{/tr}</span><br/>
                                                        {/foreach}
                                                    {else}
                                                        {foreach from=$field_value item=val key=real_val}
                                                            <span class="curSearchItem"><a href="?searchId={$searchId}&amp;action=undo&amp;param={$fieldID}&amp;type={$field_type}&amp;value={$real_val|escape:'url'}{if $show_brief_or_detailed}&amp;show_brief_or_detailed={$show_brief_or_detailed}{/if}&amp;view={$view}">[[(undo)]]</a> {tr domain=$smarty.capture.refineTranslationDomain}{$val|escape:"html"}{/tr}</span><br/>
                                                        {/foreach}
                                                    {/if}
                                                {/foreach}
                                            {/foreach}
                                            <br/>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <br/>
                            <table cellpadding="0" cellspacing="0" width="100%" id="refineResults">
                                <thead>
                                    <tr>
                                        <th class="tableLeft"> </th>
                                        <th>&nbsp;[[Refine Results]]:</th>
                                        <th class="tableRight"> </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td colspan="3">
                                            {foreach from=$refineFields item=refineField}
                                                {if $refineField.show && $refineField.count_results}
                                                <div class="refine_button"><div class="refine_icon">[+]</div><strong>[[FormFieldCaptions!{$refineField.caption}]]</strong></div>
                                                <div class="refine_block" style="display: none">
                                                    {foreach from=$refineField.search_result item=val name=fieldValue}
                                                        {if $smarty.foreach.fieldValue.iteration == 6}
                                                            <div class="block_values" style="display: none">
                                                        {/if}
                                                        {capture name="refineTranslationDomain"}Property_{$refineField.field_name}{/capture}
                                                        {if $refineField.criteria}
                                                            {if !in_array($val.value, $refineField.criteria) && (!$val.sid || ($val.sid && !in_array($val.sid, $refineField.criteria))) }
                                                                <div class="refineItem"><a href="?searchId={$searchId}&amp;action=refine&amp;{$refineField.field_name}[multi_like_and][]={if $val.sid}{$val.sid}{else}{$val.value|escape:'url'}{/if}{if $show_brief_or_detailed}&amp;show_brief_or_detailed={$show_brief_or_detailed}{/if}&amp;view={$view}">{tr domain=$smarty.capture.refineTranslationDomain}{$val.value|escape:'html'}{/tr}</a> ({$val.count})</div>
                                                            {/if}
                                                        {else}
                                                            <div class="refineItem"><a href="?searchId={$searchId}&amp;action=refine&amp;{$refineField.field_name}[multi_like_and][]={if $val.sid}{$val.sid}{else}{$val.value|escape:'url'}{/if}{if $show_brief_or_detailed}&amp;show_brief_or_detailed={$show_brief_or_detailed}{/if}&amp;view={$view}">{tr domain=$smarty.capture.refineTranslationDomain}{$val.value|escape:'html'}{/tr}</a> ({$val.count})</div>
                                                        {/if}
                                                    {/foreach}
                                                    {if $smarty.foreach.fieldValue.total >= 6}
                                                        </div><div class="block_values_button"> &nbsp; &#187; [[more]]</div>
                                                    {/if}
                                                </div>
                                                {/if}
                                            {/foreach}
                                            <br/>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        {/if}
                    </div>
                </div>
            </div>
        {/if}
		<!-- END REFINE SEARCH -->

		<!-- LISTINGS TABLE -->
        <div id="listingsResults">
            {if $listings}
                {if $view == 'map'}
                    {include file='google_map_results.tpl'}
                {else}
					<table cellspacing="0">
						<thead>State
							<tr>
								<th class="tableLeft"> </th>
								<th width="50%">
									<a href="?searchId={$searchId}&amp;action=search&amp;sorting_field=Title&amp;sorting_order={if $listing_search.sorting_order == 'ASC' && $listing_search.sorting_field == 'Title'}DESC{else}ASC{/if}&amp;page={$listing_search.current_page}">[[FormFieldCaptions!Title]]</a>
									{if $is_show_brief_or_detailed}
										<a href="?{if $searchId}searchId={$searchId}&amp;{/if}{if $params|strpos:"searchId" !== false}{$params|regex_replace:"/searchId=$searchId&amp;/":""|regex_replace:"/&amp;show_brief_or_detailed=$show_brief_or_detailed/":""}{else}{$params}{/if}&amp;show_brief_or_detailed={if $show_brief_or_detailed == 'brief'}detailed{else}brief{/if}" id="showBriefOrDetailed">({if $show_brief_or_detailed == 'brief'}[[show detailed]]{else}[[show brief]]{/if})</a>
									{/if}
									{if $listing_search.sorting_field == 'Title'}{if $listing_search.sorting_order == 'ASC'}<img src="{image}b_up_arrow.png" alt="Up" />{else}<img src="{image}b_down_arrow.png" alt="Down" />{/if}{/if}
								</th>
								<th width="20%">
									{if $userInfo.CompanyName eq '' }
										<a href="?searchId={$searchId}&amp;action=search&amp;sorting_field=CompanyName&amp;sorting_order={if $listing_search.sorting_order == 'ASC' && $listing_search.sorting_field == 'CompanyName'}DESC{else}ASC{/if}&amp;page={$listing_search.current_page}">[[FormFieldCaptions!Company]]</a>
										{if $listing_search.sorting_field == 'CompanyName'}{if $listing_search.sorting_order == 'ASC'}<img src="{image}b_up_arrow.png" alt="Up" />{else}<img src="{image}b_down_arrow.png" alt="Down" />{/if}{/if}
									{/if}
								</th>
								<th width="20%">
									<a href="?searchId={$searchId}&amp;action=search&amp;sorting_field=State&amp;sorting_order={if $listing_search.sorting_order == 'ASC' && $listing_search.sorting_field == 'State'}DESC{else}ASC{/if}&amp;page={$listing_search.current_page}">[[FormFieldCaptions!State]]</a>
									{if $listing_search.sorting_field == 'State'}{if $listing_search.sorting_order == 'ASC'}<img src="{image}b_up_arrow.png" alt="Up" />{else}<img src="{image}b_down_arrow.png" alt="Down" />{/if}{/if}
								</th>
								<th width="10%">
									<a href="?searchId={$searchId}&amp;action=search&amp;sorting_field=activation_date&amp;sorting_order={if $listing_search.sorting_order == 'ASC' && $listing_search.sorting_field == 'activation_date'}DESC{else}ASC{/if}&amp;page={$listing_search.current_page}">[[FormFieldCaptions!Posted]]</a>
									{if $listing_search.sorting_field == 'activation_date'}{if $listing_search.sorting_order == 'ASC'}<img src="{image}b_up_arrow.png" alt="Up" />{else}<img src="{image}b_down_arrow.png" alt="Down" />{/if}{/if}
								</th>
								<th class="tableRight"> </th>
							</tr>
						</thead>
						<tbody>
							<!-- Job Info Start -->
							{include file="search_results_jobs_listings.tpl"}
							<!-- END Job Info Start -->
						</tbody>
					</table>
                {/if}
            {else}
                <table cellspacing="0">
                    <thead>
                        <tr>
                            <th class="tableLeft"> </th>
                            <th width="50%">[[FormFieldCaptions!Title]]</th>
                            <th width="20%">[[FormFieldCaptions!Company]]</th>
                            <th width="20%">[[FormFieldCaptions!State]]</th>
                            <th width="10%">[[FormFieldCaptions!Posted]]</th>
                            <th class="tableRight"> </th>
                        </tr>
                    </thead>
                    <tbody>
                        <!-- Job Info From Listings Providers Here -->
                        <tr id="no_listings_found">
                            <td colspan="6" style="text-align: center; margin-left: auto; margin-right: auto;">[[There are no postings meeting the criteria you specified]]</td>
                        </tr>

                        <!-- preloader row here -->
                        <tr id="ajax_preloader_listings_results" style="display: none;">
                            <td colspan="6" style="text-align: center; margin-left: auto; margin-right: auto;">&nbsp;<img src="{$GLOBALS.site_url}/templates/_system/main/images/ajax_preloader_circular_32.gif" /></td>
                        </tr>

                    </tbody>
                </table>
            {/if}
        </div>
		<!-- END LISTINGS TABLE -->
		
		{* load scripts for used api *}
		{if $api}
            {if $api_used_indeed}
            	<script type="text/javascript" src="http://www.indeed.com/ads/apiresults.js"></script>
            {/if}
            {if $api_used_simplyHired}
            	<script type="text/javascript" src="http://api.{$GLOBALS.settings.simplyHiredSiteUrl}/c/jobs-api/js/xml-v2.js"></script>
            {/if}
        {/if}
        
		<!-- BOTTOM RESULTS - PER PAGE - PAGE NAVIGATION -->
		<div id="endResults">
			<div class="topResultsLinks">
				<div class="topNavBarLeft"></div>
				<div class="topNavBar">
					<div class="numberResults">
						{assign var="listings_number" value=$listing_search.listings_number}
						[[Results:]] {$listings_number} {if $listings_number == 1}[[Job]]{else}[[Jobs]]{/if}
						{if $search_criteria.ZipCode.value.location and $search_criteria.ZipCode.value.radius}
							{assign var="radius" value=$search_criteria.ZipCode.value.radius}
							{capture name=radius_search_unit}
								[[$GLOBALS.radius_search_unit]]
							{/capture}
							{assign var="radius_search_unit" value=$smarty.capture.radius_search_unit|escape:"html"}
							{assign var="location" value=$search_criteria.ZipCode.value.location|escape:"html"}
							[[within $radius $radius_search_unit of $location]]
						{/if}
					</div>
					<div class="numberPerPage">
						<form id="listings_per_page_form" method="get" action="" class="tableSRNavPerPage">
							[[Number of jobs per page]]:
							<select id="listings_per_page2" name="listings_per_page2" onchange="submitForm(2); return false;">
								<option value="10" {if $listing_search.listings_per_page == 10}selected="selected"{/if}>10</option>
								<option value="20" {if $listing_search.listings_per_page == 20}selected="selected"{/if}>20</option>
								<option value="50" {if $listing_search.listings_per_page == 50}selected="selected"{/if}>50</option>
								<option value="100" {if $listing_search.listings_per_page == 100}selected="selected"{/if}>100</option>
							</select>
						</form>
					</div>
                    {if !$view == 'map'}
                        <div class="pageNavigation">
                            <span class="prevBtn"><img src="{image}prev_btn.png" alt=""/>
                            {if $listing_search.current_page-1 > 0}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page-1}&amp;view={$view}">[[Previous]]</a>{else}<a>[[Previous]]</a>{/if}</span>
                            <span class="navigationItems">
                                {if $listing_search.current_page-3 > 0}<a href="?searchId={$searchId}&amp;action=search&amp;page=1&amp;view={$view}">1</a>{/if}
                                {if $listing_search.current_page-3 > 1}...{/if}
                                {if $listing_search.current_page-2 > 0}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page-2}&amp;view={$view}">{$listing_search.current_page-2}</a>{/if}
                                {if $listing_search.current_page-1 > 0}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page-1}&amp;view={$view}">{$listing_search.current_page-1}</a>{/if}
                                <strong>{$listing_search.current_page}</strong>
                                {if $listing_search.current_page+1 <= $listing_search.pages_number}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page+1}&amp;view={$view}">{$listing_search.current_page+1}</a>{/if}
                                {if $listing_search.current_page+2 <= $listing_search.pages_number}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page+2}&amp;view={$view}">{$listing_search.current_page+2}</a>{/if}
                                {if $listing_search.current_page+3 < $listing_search.pages_number}...{/if}
                                {if $listing_search.current_page+3 < $listing_search.pages_number + 1}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.pages_number}&amp;view={$view}">{$listing_search.pages_number}</a>{/if}
                            </span>
                            <span class="nextBtn">{if $listing_search.current_page+1 <= $listing_search.pages_number}<a href="?searchId={$searchId}&amp;action=search&amp;page={$listing_search.current_page+1}&amp;view={$view}">[[Next]]</a>{else}<a>[[Next]]</a>{/if}
                            <img src="{image}next_btn.png" alt=""/></span>
                        </div>
                    {/if}

				</div>
				<div class="topNavBarRight"></div>
			</div>
		</div>
		<!-- END BOTTOM RESULTS - PER PAGE - PAGE NAVIGATION -->
	</div>
{/if}


	<script>
	{literal}
		$(".refine_button").click(function(){
			var butt = $(this);
			$(this).next(".refine_block").slideToggle("normal", function(){
					if ($(this).css("display") == "block") {
						butt.children(".refine_icon").html("[-]");
					} else {
						butt.children(".refine_icon").html("[+]");
					}
				});
		});
		$(".block_values_button").click(function(){
			var butt = $(this);
			$(this).prev(".block_values").slideToggle("normal", function(){
					if ($(this).css("display") == "block") {
						butt.html("{/literal} &nbsp; &#171; [[less]]{literal}");
					} else {
						butt.html("{/literal} &nbsp; &#187; [[more]]{literal}");
					}
				});
		});
		{/literal}
			{if $keywordsHighlight}
				$("#listingsResults").highlight("{$keywordsHighlight}");
			{/if}

		{if !$is_company_profile_page}
		{literal}

		function requestToListingsProviders() {
			$('#ajax_preloader_listings_results').show();

			// request to listings providers
			var ajaxUrl = "{/literal}{$GLOBALS.site_url}/ajax/{literal}";
			var ajaxParams = {
				'action' : 'request_for_listings',
				'listing_type[equal]' : 'Job',
				'searchId' : '{/literal}{$searchId}{literal}',
				'page' : '{/literal}{$listing_search.current_page}{literal}'
			};

			$.get(ajaxUrl, ajaxParams, function(data) {
				if (data.length > 0) {
					$("#no_listings_found").hide();
				}
				$('#ajax_preloader_listings_results').hide();
				$('#listingsResults > table > tbody').append(data);
			});
		}

		// make request to listings providers after page loads
		$(function() {
			requestToListingsProviders();
		});

		{/literal}
		{/if}
	</script>


